package Activity3;

import java.util.Scanner;

public class NumberGame {
    public static void main(String[] args) {
        String word = "China"; // 目标单词
        String input, guess="";
        Scanner sc = new Scanner(System.in);

        do {
            System.out.println("\nEnter your Guess (one letter): ");
            input = sc.nextLine();

            // 确保用户输入的是单个字符
            if (input.length() != 1) {
                System.out.println("Please enter only one letter.");
                continue;
            }

            // 将输入和目标单词统一转为小写进行比较
            boolean isPresent = word.toLowerCase().contains(input.toLowerCase());

            if (isPresent) {
                System.out.println("This letter is present in the word!");
            } else {
                System.out.println("This letter is not present in the word!");
            }

            System.out.println("Do you want to continue? (y/n)");
            guess = sc.nextLine();
        } while (guess.equalsIgnoreCase("y")); // 忽略大小写判断用户是否继续

        sc.close(); // 关闭扫描器
    }
}